<?php if(!defined('BASEPATH'))exit('No direct script access allowed'); ?>
<?php $this->load->view('admin/global/header'); ?>
<?php $this->load->view('admin/global/left'); ?>
<table cellpadding="0" cellspacing="0">
    <tr>
        <td class="title"><?php if(isset($banner)){echo lang('EDIT').': '.lang('BANNER');}else{echo lang('ADD').': '.lang('BANNER');} ?></td>
    </tr>
    <?php if(isset($denied)){ ?>
    <tr>
        <td class="bar">
            <div class="error"><?php echo lang('DENIED'); ?></div>
            <meta http-equiv="refresh" content="5; <?php echo base_url().ADMIN_PATH; ?>" />
        </td>
    </tr>
    <?php }else{ ?>
    <?php if($success == true){ ?>
    <tr>
        <td class="bar">
            <div class="success"><?php echo lang('SUCCESS_UPDATED_DATA'); ?></div>
            <meta http-equiv="refresh" content="1" />
        </td>
    </tr>
    <?php }else{ ?>
    <?php echo Modules::run('admin/bar_module/index', $buttons); ?>
    <tr>
        <td valign="top">
        <form name="frmPost" id="frmPost" method="post" enctype="multipart/form-data">
            <table class="form" align="center" cellpadding="0" cellspacing="0">
                <tr>
                    <td class="label"><span class="red">*</span> <?php echo lang('TITLE'); ?>:</td>
                    <td>
                        <input type="text" name="txtTitle" class="input" value="<?php if(isset($banner)){echo set_value('txtTitle', $banner->banTitle);}else{echo set_value('txtTitle');} ?>" />
                        <?php echo form_error('txtTitle'); ?>
                    </td>
                </tr>
                <tr>
                    <td class="label"><?php echo lang('BANNER'); ?>:</td>
                    <td>
                        <input type="file" name="txtBanner" />
                        <?php if(isset($banner) && trim($banner->banBanner) != ''){ ?>
                        <img src="<?php echo base_url(); ?>templates/admin/images/expand.png" class="tip vtip" title="<?php echo tip(base_url().IMAGE_PATH.'banners/'.$banner->banDirBanner.'/'.$banner->banBanner, true); ?>" align="top" style="margin-top:4px;" />
                        <?php } ?>
                        <img src="<?php echo base_url(); ?>templates/admin/images/tip.jpg" class="tip vtip" title="<?php echo lang('BANNER_TIP'); ?>" align="top" />
                    </td>
                </tr>
                <tr>
                    <td class="label"><?php echo lang('URL'); ?>:</td>
                    <td>
                        <input type="text" name="txtUrl" class="input" value="<?php if(isset($banner)){echo set_value('txtUrl', $banner->banUrl);}else{echo set_value('txtUrl');} ?>" />
                    </td>
                </tr>
                <tr>
                    <td class="label95"><?php echo lang('CODE_BANNER'); ?></td>
                    <td>
                        <textarea name="txtCode" class="textarea"><?php if(isset($banner)){echo set_value('txtCode', $banner->banCode);}else{echo set_value('txtCode');} ?></textarea>
                    </td>
                </tr>
                <tr>
                    <td class="label"><span class="red">*</span> <?php echo lang('TARGET'); ?></td>
                    <td>
                        <select name="txtTarget" class="select">
                            <option value="_blank" <?php if(isset($banner) && trim(strtoupper($banner->banTarget)) == '_BLANK'){echo set_select('txtTarget', '_blank', true);}else{echo set_select('txtTarget', '_blank');} ?>><?php echo lang('_BLANK'); ?></option>
                            <option value="_parent" <?php if(isset($banner) && trim(strtoupper($banner->banTarget)) == '_PARENT'){echo set_select('txtTarget', '_parent', true);}else{echo set_select('txtTarget', '_parent');} ?>><?php echo lang('_PARENT'); ?></option>
                            <option value="_self" <?php if(isset($banner) && trim(strtoupper($banner->banTarget)) == '_SELF'){echo set_select('txtTarget', '_self', true);}else{echo set_select('txtTarget', '_self');} ?>><?php echo lang('_SELF'); ?></option>
                            <option value="_top" <?php if(isset($banner) && trim(strtoupper($banner->banTarget)) == '_TOP'){echo set_select('txtTarget', '_top', true);}else{echo set_select('txtTarget', '_top');} ?>><?php echo lang('_TOP'); ?></option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td class="label"><span class="red">*</span> <?php echo lang('POSITION'); ?></td>
                    <td>
                        <select name="txtPosition" class="select">
                            <option value="1" <?php if(isset($banner) && (int)$banner->banPosition == 1){echo set_select('txtPosition', 1, true);}else{echo set_select('txtPosition', 1);} ?>><?php echo lang('BOX'); ?></option>
                            <option value="2" <?php if(isset($banner) && (int)$banner->banPosition == 2){echo set_select('txtPosition', 2, true);}else{echo set_select('txtPosition', 2);} ?>><?php echo lang('TOP'); ?></option>
                            <option value="3" <?php if(isset($banner) && (int)$banner->banPosition == 3){echo set_select('txtPosition', 3, true);}else{echo set_select('txtPosition', 3);} ?>><?php echo lang('MIDDLE'); ?></option>
                            <option value="4" <?php if(isset($banner) && (int)$banner->banPosition == 4){echo set_select('txtPosition', 4, true);}else{echo set_select('txtPosition', 4);} ?>><?php echo lang('LEFT_BOTTOM'); ?></option>
                            <option value="5" <?php if(isset($banner) && (int)$banner->banPosition == 5){echo set_select('txtPosition', 5, true);}else{echo set_select('txtPosition', 5);} ?>><?php echo lang('RIGHT_BOTTOM'); ?></option>
                            <option value="6" <?php if(isset($banner) && (int)$banner->banPosition == 6){echo set_select('txtPosition', 6, true);}else{echo set_select('txtPosition', 6);} ?>><?php echo lang('LEFT'); ?></option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td class="label"><?php echo lang('ORDER'); ?>:</td>
                    <td>
                        <input type="text" name="txtOrder" class="inputOrder" value="<?php if(isset($banner)){echo set_value('txtOrder', $banner->banOrder);}else{echo set_value('txtOrder');} ?>" />
                        <?php echo form_error('txtOrder'); ?>
                    </td>
                </tr>
                <tr>
                    <td class="label"><span class="red">*</span> <?php echo lang('FULLNAME'); ?>:</td>
                    <td>
                        <input type="text" name="txtFullname" class="input" value="<?php if(isset($banner)){echo set_value('txtFullname', $banner->banFullname);}else{echo set_value('txtFullname');} ?>" />
                        <?php echo form_error('txtFullname'); ?>
                    </td>
                </tr>
                <tr>
                    <td class="label"><?php echo lang('ADDRESS'); ?>:</td>
                    <td>
                        <input type="text" name="txtAddress" class="input" value="<?php if(isset($banner)){echo set_value('txtAddress', $banner->banAddress);}else{echo set_value('txtAddress');} ?>" />
                    </td>
                </tr>
                <tr>
                    <td class="label"><span class="red">*</span> <?php echo lang('EMAIL'); ?>:</td>
                    <td>
                        <input type="text" name="txtEmail" class="input" value="<?php if(isset($banner)){echo set_value('txtEmail', $banner->banEmail);}else{echo set_value('txtEmail');} ?>" />
                        <?php echo form_error('txtEmail'); ?>
                    </td>
                </tr>
                <tr>
                    <td class="label"><span class="red">*</span> <?php echo lang('PHONE'); ?>:</td>
                    <td>
                        <input type="text" name="txtPhone" class="input" value="<?php if(isset($banner)){echo set_value('txtPhone', $banner->banPhone);}else{echo set_value('txtPhone');} ?>" />
                        <img src="<?php echo base_url(); ?>templates/admin/images/tip.jpg" class="tip vtip" title="<?php echo lang('TEL_FAX_TIP'); ?>" align="top" />
                        <?php echo form_error('txtPhone'); ?>
                    </td>
                </tr>
                <tr>
                    <td class="label"><?php echo lang('MOBILE'); ?>:</td>
                    <td>
                        <input type="text" name="txtMobile" class="input" value="<?php if(isset($banner)){echo set_value('txtMobile', $banner->banMobile);}else{echo set_value('txtMobile');} ?>" />
                        <img src="<?php echo base_url(); ?>templates/admin/images/tip.jpg" class="tip vtip" title="<?php echo lang('TEL_FAX_TIP'); ?>" align="top" />
                        <?php echo form_error('txtMobile'); ?>
                    </td>
                </tr>
                <tr>
                    <td class="label"><?php echo lang('FAX'); ?>:</td>
                    <td>
                        <input type="text" name="txtFax" class="input" value="<?php if(isset($banner)){echo set_value('txtFax', $banner->banFax);}else{echo set_value('txtFax');} ?>" />
                        <img src="<?php echo base_url(); ?>templates/admin/images/tip.jpg" class="tip vtip" title="<?php echo lang('TEL_FAX_TIP'); ?>" align="top" />
                        <?php echo form_error('txtFax'); ?>
                    </td>
                </tr>
                <tr>
                    <td class="label"><span class="red">*</span> <?php echo lang('EXPIRE_DATE'); ?>:</td>
                    <td>
                        <input type="text" name="txtExpireDate" class="inputDate expirePicker" value="<?php if(isset($banner)){echo set_value('txtExpireDate', date_convert($banner->banExpireDate, true, false));}else{echo set_value('txtExpireDate');} ?>" />
                        <span style="margin-left:5px; margin-right:5px;"><b><?php echo lang('OR'); ?></b></span>
                        <select name="txtNumberDate" class="select">
                            <?php for($i = 0; $i <= (EXPIRE_TIME*30); $i++){ ?>
                            <option value="<?php echo $i; ?>" <?php echo set_select('txtNumberDate', $i); ?>><?php echo $i; ?></option>
                            <?php } ?>
                        </select>
                        <span style="margin-left:5px;"><b><?php echo lang('DATE'); ?></b></span>
                        <img src="<?php echo base_url(); ?>templates/admin/images/tip.jpg" class="tip vtip" title="<?php echo lang('EXPIRE_DATE_TIP'); ?>" align="top" />
                        <?php echo form_error('txtExpireDate'); ?>
                    </td>
                </tr>
                <tr>
                    <td class="label0"><?php echo lang('ACTIVE'); ?>:</td>
                    <td>
                        <input type="checkbox" name="txtStatus" class="checkbox" value="1" <?php if(isset($banner) && (int)$banner->banStatus == 1){echo set_checkbox('txtStatus', 1, true);}else{echo set_checkbox('txtStatus', 1);} ?> />
                    </td>
                </tr>
            </table>
        </form>
        </td>
    </tr>
    <?php } ?>
    <?php } ?>
</table>
<?php $this->load->view('admin/global/right'); ?>
<?php $this->load->view('admin/global/footer'); ?>